package com.peas.platform.module.icims.base.auth.api;

import com.peas.platform.common.core.configuration.RequestContextUtil;
import com.peas.platform.common.core.dto.ResponseDto;
import com.peas.platform.module.icims.base.auth.controller.vo.UserVisitVo;
import com.peas.platform.module.icims.base.auth.service.UserVisitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@Api(tags = "自定义接口-用户访问")
@RestController
@RequestMapping("/api/v1/customUserVisit")
public class CustomUserVisitController {

    @Resource
    private UserVisitService userVisitService;

    @ApiOperation(value = "增加菜单点击次数")
    @PostMapping(value = "/addMenuClick")
    public ResponseDto<Boolean> addMenuClick(@RequestBody @Valid UserVisitVo vo) {
        vo.setUserId(Long.valueOf(RequestContextUtil.getCurrentUserId(true)));
        userVisitService.addMenuClick(vo);
        return ResponseDto.getSuccessResponseDto(true);
    }

}
